package com.woniu.finance.contorller;


import com.woniu.aop.OperationLogAnnotation;
import com.woniu.finance.entity.Role;
import com.woniu.finance.service.IRoleService;
import com.woniu.util.utils.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 角色表 前端控制器
 * </p>
 *
 * @author 刘品水
 * @since 2023-05-05
 */
@RestController
@RequestMapping("/finance/role")
public class RoleController {
    @Autowired
    private IRoleService roleService;

    @PostMapping("/saveRole")
    @OperationLogAnnotation(operModul = "融资企业-角色表",operType = "新增",operDesc = "新增角色表")//操作日志注解
    public HttpResult<?> saveRole(@RequestBody Role role){
        return roleService.saveRole(role);
    }

    @RequestMapping("/removeRole")
    @OperationLogAnnotation(operModul = "融资企业-角色表",operType = "删除",operDesc = "删除角色表")//操作日志注解
    public HttpResult<?> removeRole(Integer id){
        return roleService.removeRole(id);
    }

    @PostMapping("/modifyRole")
    @OperationLogAnnotation(operModul = "融资企业-角色表",operType = "修改",operDesc = "修改角色表")//操作日志注解
    public HttpResult<?> modifyRole(@RequestBody Role role){
        return roleService.modifyRole(role);
    }

    @RequestMapping("/findAllRole")
    @OperationLogAnnotation(operModul = "融资企业-角色表",operType = "查询",operDesc = "查询全部角色表")//操作日志注解
    public HttpResult<?> findAllRole(){
        return roleService.findAllRole();
    }

    @RequestMapping("/findAllRoleById")
    @OperationLogAnnotation(operModul = "融资企业-角色表",operType = "查询",operDesc = "根据id查询角色表")//操作日志注解
    public HttpResult<?> findAllRole(Integer id){
        return roleService.findRoleById(id);
    }
}